package core

import "C"

var Info func() string
var Event func(selfID int64, mseeageType int, subType int, groupID int64, userID int64, noticeID int64, message string, messageNum int64, messageID int64, rawMessage string, ret int32, retChan chan<- int)
var MQSet func() int64
var MQEnd func() int64

// myqq

//export MQ_Info
func MQ_Info() *C.char {
	return goString2CString(Info())
}

//export MQ_Event
func MQ_Event(QQ *C.char, MsgType, SubMsgType C.int, MsgFrom, TigObjAct, TigObjPas, Msg, MsgNum, MsgId, RawMsg *C.char, PtrNext C.int) C.int {
	retChan := make(chan int)
	go Event(cStr2GoInt64(QQ), cIntgoInt(MsgType), cIntgoInt(SubMsgType), cStr2GoInt64(MsgFrom), cStr2GoInt64(TigObjAct),
		cStr2GoInt64(TigObjPas), goString2CString2GoString(Msg), cStr2GoInt64(MsgNum), cStr2GoInt64(MsgId), goString2CString2GoString(RawMsg), int32(PtrNext), retChan)
	return C.int(<-retChan)
}

//export MQ_End
func MQ_End() C.int {
	if MQEnd == nil {
		return C.int(0)
	}
	return C.int(MQEnd())
}

//export MQ_Set
func MQ_Set() {
	MQSet()
}

// wolfqq

//export WQ_Info
func WQ_Info() *C.char {
	return goString2CString(Info())
}

//export WQ_Event
func WQ_Event(QQ *C.char, MsgType, SubMsgType C.int, MsgFrom, TigObjAct, TigObjPas, Msg, MsgNum, MsgId, RawMsg *C.char, PtrNext C.int) C.int {
	retChan := make(chan int)
	go Event(cStr2GoInt64(QQ), cIntgoInt(MsgType), cIntgoInt(SubMsgType), cStr2GoInt64(MsgFrom), cStr2GoInt64(TigObjAct),
		cStr2GoInt64(TigObjPas), goString2CString2GoString(Msg), cStr2GoInt64(MsgNum), cStr2GoInt64(MsgId), goString2CString2GoString(RawMsg), int32(PtrNext), retChan)
	return C.int(<-retChan)
}

//export WQ_End
func WQ_End() C.int {
	if MQEnd == nil {
		return C.int(0)
	}
	return C.int(MQEnd())
}

//export WQ_Set
func WQ_Set() {
	MQSet()
}

//export WQ_Message
func WQ_Message(QQ *C.char, a2 C.int, a3, a4, a5, a6 *C.char) C.int {
	return C.int(1)
}
